﻿using StarPizza.Model.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StarPizza.ViewModel
{
    abstract class SubsystemVM : VisibleVM
    {
        UserSpace userSpace;
        public SubsystemVM(UserSpace userSpace)
        {
            this.userSpace = userSpace;
            userSpace.UserModeChanged += UserModeChanged;
        }
        protected abstract bool ShouldBeVisible(UserMode userMode);
        void UserModeChanged(UserMode newUIMode)
        {
            this.IsVisible = ShouldBeVisible(newUIMode);
        }
        public void LogOff()
        {
            userSpace.LogOff();
        }
    }
}
